/* Copyright  2009-2010
   @Author
   Richard Changde Yin            e-mail yinchangde@hotmail.com

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/**
 * @filename: order.h
 */

#ifndef __ORDER_H__
#define __ORDER_H__

#include <sql_bitmap.h>
#include <field.h>

/* Order clause list element */

struct order_st {

  struct order_st *next;

  Item     **item;                /* Point at item in select fields   */

  Item     *item_ptr;              /* Storage for initial item         */

  Item   **item_copy;            /* For SPs; the original item ptr   */

  int    counter;         /* position in SELECT list, correct
                             only if counter_used is true     */

  bool     asc;                      /* true if ascending                */
  bool     free_me;                /* true if item isn't shared        */
  bool     in_field_list;        /* true if in select field list     */
  bool   counter_used;    /* parameter was counter of columns */

  Field  *field;                /* If tmp-table group               */
  char     *buff;                    /* If tmp-table group               */
  table_map used;
  table_map depend_map;
};

#endif /* __ORDER_H__ */
